﻿using System.Windows;
using System.Windows.Controls;
using Caliburn.Micro;

namespace Exones.Blend.AssetsManager
{
	public partial class ShellView : Window
	{
		public ShellView()
		{
			InitializeComponent();
			
		}

		private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
		{
			var folder = e.NewValue as BlendFolder;

			if (folder == null)
			{
				return;
			}

			var model = (ShellViewModel)IoC.Get<IShellViewModel>() ;
			model.SelectedBlendFolder = folder;
			
		}

		private void TreeView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
		{
			var model = (ShellViewModel)IoC.Get<IShellViewModel>();
			var asset = model.SelectedBlendFolder as BlendAssetFolder;
			if (asset != null)
			{
				model.UserAssetName = asset.Name;
				model.UserAssetPath = asset.Path;
			}
		}
	}
}
